<?php

Yii::import('common.models._base.BaseZoneName');

class ZoneName extends BaseZoneName
{
	public static function model($className=__CLASS__) {
		return parent::model($className);
	}
        public function rules() {
		return array(
			array('zone_name,country_id,city_id,state_id', 'required'),
			array('status, country_id, state_id, city_id', 'numerical', 'integerOnly'=>true),
			array('zone_name', 'length', 'max'=>100),
			array('status, country_id, state_id, city_id', 'default', 'setOnEmpty' => true, 'value' => null),
			array('id, zone_name, status, country_id, state_id, city_id', 'safe', 'on'=>'search'),
		);
	}
        public static function label($n = 1) {
		return Yii::t('app', 'Zone Name|Zone Names', $n);
	}
        public function relations() {
		return array(
			'localityNames' => array(self::HAS_MANY, 'LocalityName', 'zone_id'),
			'country' => array(self::BELONGS_TO, 'Country', 'country_id'),
			'state' => array(self::BELONGS_TO, 'State', 'state_id'),
                    'city' => array(self::BELONGS_TO, 'City', 'city_id'),
		);
	}
}